﻿@model IEnumerable<Model.Article>
@{
    ViewBag.Title = "Articles";
}
 
<h3> Articles existants </h3>
<table>
    <tr>
        <th> Titre </th>
        <th> Description  </th>
        <th> Image</th>
    </tr>
@foreach (var article in Model)
{
    <tr>       
        <td>
            <a href="@Url.Action(MVC.Home.ArticlesInDetail(article.Id))" title="articleEnDetail">
                @article.Title 
            </a>
        </td>
        <td>
            @{
                if (article.Content.Length > 50)
                {
                    <text>@article.Content.Substring(0, 50);</text>
                }
                else{
                    <text>@article.Content;</text>
                }
             }
        </td>
        @foreach(var image in article.ArticleImages)
        {
           <td><img src= "@image.Image.Url" /></td>
        }
    </tr>

        
}
</table>
